<?php

class AreaTable extends Doctrine_Table
{
	public function getAdminAreaListQuery()
	{
		$user = sfContext::getInstance()->getUser();

		$query = $this->createQuery('r');
    
    if (!$user->hasCredential('super'))
    {
      $query->innerJoin('r.administrators a')
        ->andWhere('a.id = ?', $user->getAttribute('id'));
    }
    
    return $query;
	}

  public function getHomepageList()
  {
    return $this->createQuery('a')
      ->execute();
  }
}
